
// VS_BEGIN
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aCoord;
layout (location = 2) in vec3 aNormal;
layout (location = 3) in vec3 aTangent;
layout (location = 4) in vec3 aBitangent;

uniform mat4 u_model;


uniform vec3 lightPos;         // 灯光pos
uniform mat4 view;          // 6个方向
uniform mat4 project;       // 90度fov透视

layout (std140) uniform EngineUBO
{
    mat4 u_view;
    mat4 u_project;
    vec3 u_camPos;
    vec3 u_camInfo;
    mat4 u_inversePV;
};

out vec3 g_WorldPos;

void main() {
    g_WorldPos = (u_model * vec4(aPos, 1.0f)).xyz;
    gl_Position = project * view * u_model * vec4(aPos, 1.0f);
}
// VS_END
// FS_BEGIN
#version 330 core 
layout (location = 0) out vec3 DepthCubeMap;

// Light Packet:
// position.x position.y position.z type(PointLight: 0; DirectLight: 1; AmbientSphereLight: 2)
// color.r    color.g    color.b    strength
// direct.x   direct.y   direct.z   unuse
// unuse      unuse      unuse      unuse
layout (std140) uniform LightUBO
{
    mat4 u_lights[64];
    int u_lightNum;
};

// u_camInfo Packet:
// type(Perspective: 0, Ortho: 1) zNear zFar
layout (std140) uniform EngineUBO
{
    mat4 u_view;
    mat4 u_project;
    vec3 u_camPos;
    vec3 u_camInfo;
    mat4 u_inversePV;
};

uniform vec3 lightPos;         // 灯光pos
uniform mat4 view;          // 6个方向
uniform mat4 project;       // 90度fov透视

in vec3 g_WorldPos;

// uniform samplerCube u_irradianceMap;
// uniform samplerCube u_prefilterMap;
// uniform sampler2D   u_brdfLUT;

// out vec4 FragColor;

void main() {

    DepthCubeMap = vec3(distance(lightPos, g_WorldPos));
}
// FS_END
